chn = evtchn_from_port(d, port);
chn->state = ECS_UNBOUND;
- chn->u.unbound.remote_domid = alloc->remote_dom;
+ if ( (chn->u.unbound.remote_domid = alloc->remote_dom) == DOMID_SELF )
+ chn->u.unbound.remote_domid = current->domain->domain_id;
alloc->port = port;
struct evtchn *lchn, *rchn;
struct domain *ld = current->domain, *rd;
int lport, rport = bind->remote_port;
+ domid_t rdom = bind->remote_dom;
long rc = 0;
- if ( (rd = find_domain_by_id(bind->remote_dom)) == NULL )
+ if ( rdom == DOMID_SELF )
+ rdom = current->domain->domain_id;
+
+ if ( (rd = find_domain_by_id(rdom)) == NULL )
return -ESRCH;
/* Avoid deadlock by first acquiring lock of domain with smaller id. */
* is allocated in <dom> and returned as <port>.
* NOTES:
* 1. If the caller is unprivileged then <dom> must be DOMID_SELF.
+ * 2. <rdom> may be DOMID_SELF, allowing loopback connections.
*/
#define EVTCHNOP_alloc_unbound 6
typedef struct evtchn_alloc_unbound {
* a port that is unbound and marked as accepting bindings from the calling
* domain. A fresh port is allocated in the calling domain and returned as
* <local_port>.
+ * NOTES:
+ * 2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
*/
#define EVTCHNOP_bind_interdomain 0
typedef struct evtchn_bind_interdomain {